
using System;
using System.Drawing;

using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace bjeschool
{
	public partial class FirstPageController : UIViewController
	{
		[Action("On_ExitSys_Click")]
		void On_ExitSys_Click ()
		{
			AppDelegate.app.Window.RootViewController = new LoginController();
		}

		[Action("OnClickButton:")]
		private void OnClickButton (UIButton sender)
		{
			switch (sender.CurrentTitle) {
			case "批阅作业":{
				Show();
				//ltc.On_MyClass_Note_Click();
				ltc.On_MyClass_HomeWorkList_Click();
				break;
			}
			case "布置作业":{
				Show ();
				ltc.On_MyClass_NewHomeWork_Click();
				break;
			}
			case "通知留言":
			case "学员留言":
			case "家长留言":
			case "家校互动":{
				Show();
				ltc.On_HomeSchool_Message_Click();
				break;
			}
			case "我的课程":
				Show ();
				ltc.On_MyCourse_Course_Click();
				break;
			case "个人中心":
				Show();
				ltc.On_Personal_ModifyInformation_Click();
				break;
			default:
				break;
			}
		}

		private LeftTabController ltc;
		private void Show ()
		{
			//if (AppDelegate.split == null)
			{
				MG.MGSplitViewController mg = new MG.MGSplitViewController ();
				mg.ShowsMasterInPortrait = true;
				mg.SplitPosition = 292;
				AppDelegate.split = mg;
			}
			if(ltc == null)
				ltc = new LeftTabController ();
			AppDelegate.split.MasterViewController = ltc;
			AppDelegate.app.Window.RootViewController = AppDelegate.split;
		}

		public FirstPageController (string page) : base (page, null)
		{
		}
		
		public override void DidReceiveMemoryWarning ()
		{
			// Releases the view if it doesn't have a superview.
			base.DidReceiveMemoryWarning ();
			
			// Release any cached data, images, etc that aren't in use.
		}
		
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			
			// Perform any additional setup after loading the view, typically from a nib.
		}
		
		public override void ViewDidUnload ()
		{
			base.ViewDidUnload ();
			
			// Clear any references to subviews of the main view in order to
			// allow the Garbage Collector to collect them sooner.
			//
			// e.g. myOutlet.Dispose (); myOutlet = null;
			
			ReleaseDesignerOutlets ();
		}
		
		public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
		{
			// Return true for supported orientations
			return true;
		}
	}
}

